using UnityEngine;
// [Assembly-CSharp.dll].Store
public class Store : MonoBehaviour
{
    // Fields
    private UnityEngine.GameObject scrollView;
    private UnityEngine.UI.Button[] buttons;
    private UnityEngine.Sprite[] dogs;
    private UnityEngine.Sprite[] bees;
    private UnityEngine.Sprite[] hives;
    private UnityEngine.UI.Text coins;
    private UnityEngine.UI.Text[] dogPrices;
    private UnityEngine.UI.Text[] beePrices;
    private UnityEngine.UI.Text[] hivePrices;
    private int[] prices;
    private UnityEngine.GameObject[] selected;
    private UnityEngine.GameObject adPanel;
    private bool isBee;
    private bool isHive;
    private UnityEngine.ParticleSystem[] unlockerParticles;
    private UnityEngine.ParticleSystem leavesParticle;
    private int selectedIndex;
    
    // Methods
    private void Start()
    {
        this.AssignSprites(sprites:  this.dogs);
        this.InitializeButtons(str:  -1610599175);
        this.CheackIsUnLocked(str:  -1610599175);
        this.CheackIsUnLocked(str:  -1610600129);
        this.CheackIsUnLocked(str:  -1610598281);
        this.SelectedButton();
    }
    private void Update()
    {
        if((UnityEngine.PlayerPrefs.GetInt(key:  -1610599799)) < 1)
        {
                UnityEngine.PlayerPrefs.SetInt(key:  -1610599799, value:  0);
        }
        
        string val_3 = UnityEngine.PlayerPrefs.GetInt(key:  -1610599799).ToString();
    }
    private void InitializeButtons(string str)
    {
        string val_2 = UnityEngine.PlayerPrefs.GetInt(key:  -1610599799).ToString();
        label_39:
        var val_3 = 5 - 4;
        if(val_3 >= this.buttons.Length)
        {
                return;
        }
        
        if(val_3 >= this.buttons.Length)
        {
            goto label_55;
        }
        
        this.buttons[1].interactable = false;
        if((System.String.op_Equality(a:  str, b:  -1610599175)) == false)
        {
            goto label_6;
        }
        
        if(val_3 >= this.buttons.Length)
        {
            goto label_55;
        }
        
        this.buttons[1].transform.GetChild(index:  1).gameObject.SetActive(value:  true);
        if(val_3 >= this.buttons.Length)
        {
            goto label_55;
        }
        
        UnityEngine.GameObject val_10 = this.buttons[1].transform.GetChild(index:  2).gameObject;
        goto label_19;
        label_6:
        if((System.String.op_Equality(a:  str, b:  -1610600129)) == false)
        {
            goto label_20;
        }
        
        if(val_3 >= this.buttons.Length)
        {
            goto label_55;
        }
        
        this.buttons[1].transform.GetChild(index:  1).gameObject.SetActive(value:  false);
        if(val_3 >= this.buttons.Length)
        {
            goto label_55;
        }
        
        label_19:
        this.buttons[1].transform.GetChild(index:  2).gameObject.SetActive(value:  true);
        if(val_3 >= this.buttons.Length)
        {
            goto label_55;
        }
        
        label_60:
        this.buttons[1].transform.GetChild(index:  3).gameObject.SetActive(value:  false);
        label_62:
        var val_21 = 5 + 1;
        if(this.buttons != null)
        {
            goto label_39;
        }
        
        label_20:
        if((System.String.op_Equality(a:  str, b:  -1610598281)) == false)
        {
            goto label_41;
        }
        
        if(val_3 >= this.buttons.Length)
        {
            goto label_55;
        }
        
        this.buttons[1].transform.GetChild(index:  1).gameObject.SetActive(value:  false);
        if(val_3 >= this.buttons.Length)
        {
            goto label_55;
        }
        
        this.buttons[1].transform.GetChild(index:  2).gameObject.SetActive(value:  false);
        if(val_3 >= this.buttons.Length)
        {
            goto label_55;
        }
        
        UnityEngine.GameObject val_31 = this.buttons[1].transform.GetChild(index:  3).gameObject;
        goto label_60;
        label_41:
        UnityEngine.Debug.LogError(message:  -1610601323);
        goto label_62;
        label_55:
    }
    public void OnClickDogs()
    {
        this.scrollView.SetActive(value:  false);
        this.scrollView.SetActive(value:  true);
        this.isBee = false;
        this.isHive = false;
        this.InitializeButtons(str:  -1610599175);
        this.AssignSprites(sprites:  this.dogs);
        this.CheackIsUnLocked(str:  -1610599175);
        this.SelectedButton();
    }
    public void OnClickBees()
    {
        this.scrollView.SetActive(value:  false);
        this.scrollView.SetActive(value:  true);
        this.isBee = true;
        this.isHive = false;
        this.InitializeButtons(str:  -1610600129);
        this.AssignSprites(sprites:  this.bees);
        this.CheackIsUnLocked(str:  -1610600129);
        this.SelectedButton();
    }
    public void OnClickHive()
    {
        this.scrollView.SetActive(value:  false);
        this.scrollView.SetActive(value:  true);
        this.isBee = true;
        this.isHive = true;
        this.InitializeButtons(str:  -1610598281);
        this.AssignSprites(sprites:  this.hives);
        this.CheackIsUnLocked(str:  -1610598281);
        this.SelectedButton();
    }
    private void AssignSprites(UnityEngine.Sprite[] sprites)
    {
        var val_4 = 0;
        label_6:
        if(val_4 >= this.buttons.Length)
        {
            goto label_2;
        }
        
        if(val_4 >= this.buttons.Length)
        {
            goto label_17;
        }
        
        this.buttons[val_4].gameObject.SetActive(value:  false);
        val_4 = val_4 + 1;
        if(this.buttons != null)
        {
            goto label_6;
        }
        
        label_2:
        if(sprites.Length < 1)
        {
                return;
        }
        
        label_19:
        if(0 >= this.buttons.Length)
        {
            goto label_17;
        }
        
        this.buttons[0].gameObject.SetActive(value:  true);
        if(0 >= this.buttons.Length)
        {
            goto label_17;
        }
        
        if(0 >= sprites.Length)
        {
            goto label_17;
        }
        
        this.buttons[0].GetComponent<System.Object>().sprite = sprites[0];
        val_4 = 0 + 1;
        if(val_4 < sprites.Length)
        {
            goto label_19;
        }
        
        return;
        label_17:
    }
    public void CheackIsUnLocked(string str)
    {
        string val_19 = str;
        label_25:
        if(1 >= this.buttons.Length)
        {
            goto label_2;
        }
        
        if((UnityEngine.PlayerPrefs.GetInt(key:  val_19 + 1.ToString())) != 1)
        {
            goto label_3;
        }
        
        if(1 >= this.buttons.Length)
        {
            goto label_50;
        }
        
        this.buttons[1].interactable = true;
        if(1 >= this.buttons.Length)
        {
            goto label_50;
        }
        
        this.buttons[1].transform.GetChild(index:  1).gameObject.SetActive(value:  false);
        if(1 >= this.buttons.Length)
        {
            goto label_50;
        }
        
        this.buttons[1].transform.GetChild(index:  2).gameObject.SetActive(value:  false);
        if(1 >= this.buttons.Length)
        {
            goto label_50;
        }
        
        this.buttons[1].transform.GetChild(index:  3).gameObject.SetActive(value:  false);
        label_3:
        var val_13 = 1 + 1;
        if(this.buttons != null)
        {
            goto label_25;
        }
        
        label_2:
        if((System.String.op_Equality(a:  val_19 = str, b:  -1610599175)) == false)
        {
            goto label_27;
        }
        
        var val_28 = 0;
        label_34:
        if(val_28 >= this.dogPrices.Length)
        {
                return;
        }
        
        if(val_28 >= this.dogPrices.Length)
        {
            goto label_50;
        }
        
        var val_15 = val_28 + 1;
        if(val_15 >= this.prices.Length)
        {
            goto label_50;
        }
        
        UnityEngine.UI.Text val_27 = this.dogPrices[val_28];
        string val_16 = this.prices[val_15][32].ToString();
        val_28 = val_28 + 1;
        if(this.dogPrices != null)
        {
            goto label_34;
        }
        
        label_27:
        if((System.String.op_Equality(a:  val_19, b:  -1610600129)) == false)
        {
            goto label_36;
        }
        
        var val_30 = 0;
        label_43:
        if(val_30 >= this.beePrices.Length)
        {
                return;
        }
        
        if(val_30 >= this.beePrices.Length)
        {
            goto label_50;
        }
        
        var val_18 = val_30 + 1;
        if(val_18 >= this.prices.Length)
        {
            goto label_50;
        }
        
        UnityEngine.UI.Text val_29 = this.beePrices[val_30];
        string val_19 = this.prices[val_18][32].ToString();
        val_30 = val_30 + 1;
        if(this.beePrices != null)
        {
            goto label_43;
        }
        
        label_36:
        if((System.String.op_Equality(a:  val_19, b:  -1610598281)) == false)
        {
                return;
        }
        
        var val_31 = 0;
        label_52:
        if(val_31 >= this.hivePrices.Length)
        {
                return;
        }
        
        if(val_31 >= this.hivePrices.Length)
        {
            goto label_50;
        }
        
        var val_21 = val_31 + 1;
        if(val_21 >= this.prices.Length)
        {
            goto label_50;
        }
        
        val_19 = this.hivePrices[val_31];
        string val_22 = this.prices[val_21][32].ToString();
        val_31 = val_31 + 1;
        if(this.hivePrices != null)
        {
            goto label_52;
        }
        
        throw new NullReferenceException();
        label_50:
    }
    public void UnLockDogs(int index)
    {
        int val_9;
        this.selectedIndex = index;
        if(this.prices.Length <= index)
        {
            goto label_15;
        }
        
        val_9 = this.prices[(long)index];
        if(val_9 <= (UnityEngine.PlayerPrefs.GetInt(key:  -1610599799)))
        {
            goto label_3;
        }
        
        this.OpenADPanel();
        goto label_4;
        label_3:
        mem[536882947] + 80.Play();
        if(this.selected.Length <= index)
        {
            goto label_15;
        }
        
        val_9 = this.leavesParticle.transform;
        UnityEngine.Vector3 val_4 = this.selected[(long)index].transform.position;
        val_9.position = new UnityEngine.Vector3() {x = val_4.x, y = val_4.y, z = val_4.z};
        this.leavesParticle.Play();
        UnityEngine.PlayerPrefs.SetInt(key:  -1610599175(-1610599175) + this.selectedIndex.ToString(), value:  1);
        if(this.prices.Length <= index)
        {
            goto label_15;
        }
        
        UnityEngine.PlayerPrefs.SetInt(key:  -1610599799, value:  (UnityEngine.PlayerPrefs.GetInt(key:  -1610599799)) - this.prices[(long)index]);
        label_4:
        this.CheackIsUnLocked(str:  -1610599175);
        return;
        label_15:
    }
    public void OpenADPanel()
    {
        this.adPanel.SetActive(value:  true);
    }
    public void OnClickYes()
    {
        this.adPanel.SetActive(value:  false);
        System.Action val_1 = 536881997;
        val_1 = new System.Action(object:  this, method:  1610677929);
        mem[536882295].ShowRewardedAd(_successCallBack:  val_1);
    }
    private void UnLockOnConplete()
    {
        System.Action val_1 = 536881997;
        val_1 = new System.Action(object:  this, method:  1610677941);
        mem[536895333].AddJob(newJob:  val_1);
    }
    public void UnLockBees(int index)
    {
        int val_9;
        this.selectedIndex = index;
        if(this.prices.Length <= index)
        {
            goto label_15;
        }
        
        val_9 = this.prices[(long)index];
        if(val_9 <= (UnityEngine.PlayerPrefs.GetInt(key:  -1610599799)))
        {
            goto label_3;
        }
        
        this.OpenADPanel();
        goto label_4;
        label_3:
        mem[536882947] + 80.Play();
        if(this.selectedIndex >= this.selected.Length)
        {
            goto label_15;
        }
        
        val_9 = this.leavesParticle.transform;
        UnityEngine.Vector3 val_4 = this.selected[this.selectedIndex].transform.position;
        val_9.position = new UnityEngine.Vector3() {x = val_4.x, y = val_4.y, z = val_4.z};
        this.leavesParticle.Play();
        UnityEngine.PlayerPrefs.SetInt(key:  -1610600129(-1610600129) + this.selectedIndex.ToString(), value:  1);
        if(this.prices.Length <= index)
        {
            goto label_15;
        }
        
        UnityEngine.PlayerPrefs.SetInt(key:  -1610599799, value:  (UnityEngine.PlayerPrefs.GetInt(key:  -1610599799)) - this.prices[(long)index]);
        label_4:
        this.CheackIsUnLocked(str:  -1610600129);
        return;
        label_15:
    }
    public void UnLockHives(int index)
    {
        int val_9;
        this.selectedIndex = index;
        if(this.prices.Length <= index)
        {
            goto label_15;
        }
        
        val_9 = this.prices[(long)index];
        if(val_9 <= (UnityEngine.PlayerPrefs.GetInt(key:  -1610599799)))
        {
            goto label_3;
        }
        
        this.OpenADPanel();
        goto label_4;
        label_3:
        mem[536882947] + 80.Play();
        if(this.selectedIndex >= this.selected.Length)
        {
            goto label_15;
        }
        
        val_9 = this.leavesParticle.transform;
        UnityEngine.Vector3 val_4 = this.selected[this.selectedIndex].transform.position;
        val_9.position = new UnityEngine.Vector3() {x = val_4.x, y = val_4.y, z = val_4.z};
        this.leavesParticle.Play();
        UnityEngine.PlayerPrefs.SetInt(key:  -1610598281(-1610598281) + this.selectedIndex.ToString(), value:  1);
        if(this.prices.Length <= index)
        {
            goto label_15;
        }
        
        UnityEngine.PlayerPrefs.SetInt(key:  -1610599799, value:  (UnityEngine.PlayerPrefs.GetInt(key:  -1610599799)) - this.prices[(long)index]);
        label_4:
        this.CheackIsUnLocked(str:  -1610598281);
        return;
        label_15:
    }
    public void Select(int index)
    {
        var val_2;
        if(this.isBee != false)
        {
                val_2 = 27531544;
        }
        
        UnityEngine.PlayerPrefs.SetInt(key:  (this.isHive == false) ? 27531552 : 27531560, value:  index);
        this.SelectedButton();
    }
    private void SelectedButton()
    {
        Unknown val_2;
        string val_3;
        val_2 = this.selected;
        var val_3 = 0;
        label_5:
        if(val_3 >= this.selected.Length)
        {
            goto label_2;
        }
        
        if(val_3 >= this.selected.Length)
        {
            goto label_10;
        }
        
        val_2[val_3].SetActive(value:  false);
        val_2 = this.selected;
        val_3 = val_3 + 1;
        if(val_2 != null)
        {
            goto label_5;
        }
        
        throw new NullReferenceException();
        label_2:
        if(this.isBee != false)
        {
                val_3 = -1610599419;
        }
        else
        {
                if(this.isHive != false)
        {
                val_3 = -1610599415;
        }
        else
        {
                val_3 = -1610599417;
        }
        
        }
        
        int val_1 = UnityEngine.PlayerPrefs.GetInt(key:  val_3);
        if(val_1 < this.selected.Length)
        {
                val_2[val_1].SetActive(value:  true);
            return;
        }
        
        label_10:
    }
    public Store()
    {
    
    }
    private void <UnLockOnConplete>b__28_0()
    {
        mem[536882947] + 80.Play();
        if(this.isBee == false)
        {
            goto label_3;
        }
        
        if(this.selectedIndex >= this.selected.Length)
        {
            goto label_21;
        }
        
        UnityEngine.Vector3 val_3 = this.selected[this.selectedIndex].transform.position;
        this.leavesParticle.transform.position = new UnityEngine.Vector3() {x = val_3.x, y = val_3.y, z = val_3.z};
        label_26:
        this.leavesParticle.Play();
        UnityEngine.PlayerPrefs.SetInt(key:  -1610600129(-1610600129) + this.selectedIndex.ToString(), value:  1);
        this.CheackIsUnLocked(str:  -1610600129);
        return;
        label_3:
        if(this.isHive == false)
        {
            goto label_11;
        }
        
        UnityEngine.PlayerPrefs.SetInt(key:  -1610599175(-1610599175) + this.selectedIndex.ToString(), value:  1);
        this.CheackIsUnLocked(str:  -1610599175);
        if(this.selectedIndex >= this.selected.Length)
        {
            goto label_21;
        }
        
        UnityEngine.Vector3 val_10 = this.selected[this.selectedIndex].transform.position;
        this.leavesParticle.transform.position = new UnityEngine.Vector3() {x = val_10.x, y = val_10.y, z = val_10.z};
        this.leavesParticle.Play();
        return;
        label_11:
        if(this.selectedIndex >= this.selected.Length)
        {
            goto label_21;
        }
        
        UnityEngine.Vector3 val_13 = this.selected[this.selectedIndex].transform.position;
        this.leavesParticle.transform.position = new UnityEngine.Vector3() {x = val_13.x, y = val_13.y, z = val_13.z};
        goto label_26;
        label_21:
    }

}
